home *** CD-ROM | disk | FTP | other *** search
/ Commodore Free 29 / Commodore_Free_Issue_29_2009_Commodore_Computer_Club.d64 / biz calc desc < prev    next >
Text File  |  2023-02-26  |  15KB  |  553 lines

  1. u
  2.  
  3.  
  4.  
  5. EDITOR'S NOTE:
  6.  
  7. The 'C16 BIZ CALC' program is stored
  8. on this disk. However, it is written
  9. for the C16 in a version of BASIC that
  10. is not compatible with C64 BASIC V2.
  11.  
  12. The program will RUN on a C128 with
  13. BASIC V7 if you LOAD it with:
  14.  
  15.  LOAD"C16 BIZ CALC",8
  16.  
  17. If you just want to view the program
  18. listing on your C64, RESET your
  19. computer & type:
  20.  
  21.  LOAD"C16 BIZ CALC",8
  22.  
  23. When ready appears type LIST.
  24.  
  25.  ***********************************
  26.  * Business Calculator Description.*
  27.  *         The Masterpiece!        *
  28.  ***********************************
  29.  
  30.  
  31. Databases and Spreadsheets are
  32. great...
  33. if you can spare half your life to
  34. learn them, then spend the other half
  35. Wrestling with cells and complicated
  36. Mathematical formulas etc.  Business
  37. Calculator (Biz Calc from now on)
  38. attempts to take all that trauma and
  39. hassle away and let the user get
  40. straight into it.
  41.  
  42. Originally started out of a personal
  43. annoyance that shops less and less
  44. include VAT in the price.  (Does
  45. any-one out there share this?  I
  46. resent it being rubbish at Maths; and
  47. quite slow! as yet another deception
  48. based on greed in my view.  But what
  49. can I do about it!)  Anyway, the
  50. program grew into helping some-one
  51. with their small business -so I don't
  52. hate commerce completely..?
  53.  
  54. TUTORIAL
  55. It has become rather larger than
  56. simply working out how much the blood
  57. suckers will take.  For those without
  58. a business, it may better to find VAT
  59. Calculator, the prequel to this
  60. program.  All the features are here,
  61. but the inclusions for business may
  62. make it more complicated to
  63. understand.  So here's a How To... of
  64. all the business features.  ...Simply
  65. read the listing from 1500 !
  66.  
  67. Perhaps I haven't explained key press
  68. 2 properly.  Though a bit of trial
  69. and error rehearsal will see most
  70. pick it up quickly.  While one
  71.  
  72. "1" counts up a list of expenses.
  73.  
  74. "2" allows the user to Add to the
  75. takings, or change it altogether.
  76. There isn't a list for income as I
  77. did not see a need.  This is printed
  78. as positives to add before taking
  79. from takings.  (see!  Not at all
  80. complicated -"pff !")  The total is
  81. listed on the main menu as "Total
  82. Expense:"  (Sorry, if that's somewhat
  83. dull or predictable.)
  84.  
  85. "4", you will notice only the top
  86. figures are changed.  In case a quick
  87. reference is needed to a possible
  88. purchase, but the program needs
  89. keeping in tact. Although it also
  90. affects both percentage / takings
  91. listings. (possibly a bug.  Or down
  92. to the fact I wrote this blindly for
  93. a friend who I haven't seen in a long
  94. time, I hope that my efforts would be
  95. of some use to him. ...Clearly not,
  96. as he still isn't speaking!)
  97.  
  98. "0" resets expense list.  And I've
  99. got to say, in looking at it again
  100. The "To Tax Man/persons" only looks
  101. anywhere near right when there are no
  102. expenses to work out!  We may look at
  103. this in the program description that
  104. follows.  And may arrive at a
  105. solution such as changing to "Total
  106. Outgoing", or adding this, and
  107. working out what Tax is actually
  108. paid.
  109.  
  110. Looking at the program.
  111. -----------------------
  112. My first lesson in debugging or
  113. describing to others what things do,
  114. was to make a note at the time of the
  115. variables.  As now when I look some
  116. weeks later it's like trying to get
  117. sense out of a politician!  At this
  118. point I will be nothing short of
  119. amazed if I remember everything.  And
  120. will have to look deeper into the
  121. code than I wanted to.  This is more
  122. time consuming, and I have the
  123. washing up to do yet!
  124.  
  125. Here's what I do know:
  126. ----------------------
  127. Line 10 Always title your program in
  128. the first line of your code.  The
  129. easiest way to know what it is.
  130.  
  131. Line 20 I wanted background colour
  132. white, and the ink to be mostly
  133. black.  (reminds me of a song I sang
  134. at school) People were saying they
  135. were having trouble reading the other
  136. colours.  The border on the other
  137. hand is reserved for something quite
  138. special which I will come to in due
  139. course.  The border is set this way
  140. as the best choice only minor trouble
  141. being there seems no way to get the
  142. original border colour.  Ah! well.
  143. If you know of a way, please let me
  144. know.
  145.  
  146. Line 30  Clear memory of all prior
  147. memory, but keeping the program.
  148. - ML is Maximum Limit for list.
  149. Tinker with this if you need to.
  150.  
  151. - XP is short for "expense" -(haha!
  152. Nothing like Windows then eh!)  It
  153. allows for a listing related to ML.
  154. It is also possible to type in a list
  155. of Income if needed for TaxMan/Person
  156. etc.
  157.  
  158. - VA is VAT or Value Added Tax.
  159. (nice to assume "Value" anyway..
  160. This is set to the current rate.  Can
  161. be changed either by altering the
  162. figure here, and saving.  Or during
  163. the program which can also be saved.
  164.  
  165. - T is Takings.  Presetting an amount
  166. is useful.  It not only saves awkward
  167. bugs.  It allows for examples to show
  168. the program is working.
  169.  
  170. - XP$ is linked to xp in that it is
  171. the string corresponding to the
  172. number
  173.  
  174. - c% is the colour for the menu
  175. later.  You will see in line 20 the
  176. command ...Color4,6.  Border colour
  177. of 6.  Which could have been done
  178. quite differently so that if a change
  179. were needed only one line would need
  180. changing.  Try moving "CLR" to the
  181. start of 20, put "C%=6" straight
  182. after it, followed by the colours.
  183. And change the colour 4, to c%.  Then
  184. if you want to start with a new
  185. border colour you only need to change
  186. the c%=... Within the legal range
  187. 1-16 (off the top of my head) This is
  188. so it doesn't look funny when you go
  189. to the border changing menu.
  190.  
  191. Line 40 Set maximum volume.
  192.  
  193. Line 50 Saves time retyping a
  194. commonly used string.
  195.  
  196. Line 60 SCNCLR: A way of clearing the
  197. screen.  Simply means "ScreenClear".
  198. Like PRINT"ctrl & home";  On some
  199. models of 8 bit computers it was or
  200. IS simply CLS.  And is the one of few
  201. of the  compatibility problems I can
  202. think users may face when typing in
  203. any of my programs in this series. I
  204. haven't used POKES & PEEKS which
  205. would be another problem as they have
  206. meanings individual to the machines.
  207. And VOL is a POKE statement on the
  208. c64 (line40)
  209.  
  210. Line 70-90 establishes with user what
  211. the current percentage is.
  212.  
  213. Line 100 type your own Total here.
  214. Or the price of something you wish to
  215. buy when the sales berk, sorry
  216. "clerk" is being coy with the true
  217. cost to your livelihood.
  218.  
  219. Line 110-120 prints info. for sake of
  220. speed.
  221.  
  222. Line 130 does percentage calculation
  223. (Yawn!)
  224.  
  225. Line 140-160 As 110-120
  226.  
  227. Line 170 Share the variable in order
  228. to do something else with it later.
  229. (This was easy to remember:  As to
  230. eat you must have something left over
  231. after TAX -good Luck!  And, like
  232. sharing a meal.  Empty = (time for)
  233. Tee!) 
  234.  
  235. Line 180 Make sure user has read
  236. info.  And is happy to go on.
  237.  
  238. Line 190 Needed as a point of
  239. reference, so that if anything needs
  240. to be added there is an extra '10' in
  241. the process.  The other reason is
  242. that REM statements mark out a new
  243. section better than leaving it to
  244. PRINT, which could be anything.
  245.  
  246. Line 200-210 Clear Screen and print
  247. Title Business Calc  (bc$), and Main
  248. Menu.
  249.  
  250. Line 220 Debugging, deciding best
  251. order.  If you find the others linked
  252. to this statement, you can experiment
  253. and see what they do. (remove REM to
  254. try)
  255.  
  256. Line 230-260 Printing the menu, and
  257. calculates   This takes some
  258. understanding. ..Good Luck! ..OK.
  259.  
  260. - VA = Percent, originally stood for
  261. VAT.
  262. - T, as it says is Takings:  T-X:
  263. - X being the result of the formula
  264. you make the bare figure actually
  265. work out as a percentage sum.  Thus
  266. instead of deducting 17.5 from the
  267. current takings.  X permeates this to
  268. the appropriate percentage first.
  269. Otherwise the answer is completely
  270. different.
  271. - Y relates to the other part of the
  272. screen.  As covered above.
  273.  
  274. Line 280 resets a variable to be used
  275. to avoid even more embarrassment than
  276. not knowing what I'm doing.
  277.  
  278. Line 290-310 Uses the above variable
  279. in a for/next loop... for something
  280. or other... (see 330)  XP stands for
  281. Expense.  The little goes through the
  282. list of expenses to total them.
  283.  
  284. Line 320-360 Self Explanatory
  285. Line 370-380 Why MU???  I can't
  286. remember.  But this is where the TAX
  287. is deducted as whole outgoings.
  288.  
  289. Line 390 Another GOTO statement
  290. cancelled out by the preceding REM
  291. command.
  292.  
  293. Line 400 Tells the computer if it has
  294. gone above the on/off limit to reset
  295. to off and follow line by line.
  296.  
  297. Line 410 If H% (meaning whether to
  298. hide or not the instructions that may
  299. make the program hard to read.  If H%
  300. is on (1) assume the user knows these
  301. things.
  302.  
  303. Line 420-500 Self Explanatory
  304.  
  305. Line 510 The extra command, this
  306. works anyway, see 620.  A Question
  307. you may be asking is Why hide it?
  308. Especially as 2 or so arrow up
  309. presses at the end of the line just
  310. before the inverted commas will serve
  311. to keep the page intact. The Answer.
  312. Yes.  But it would impede on
  313. expanding elsewhere.  It is aesthetic
  314. therefore less important.  Just saves
  315. the user typing in the command of the
  316. colour they prefer.  Having said that
  317. this isn't impossible as the program
  318. can currently be read, though I did
  319. try to get a compiler.  No reply
  320. though. Also, it would be easier
  321. another way.  Try reprogramming to
  322. keep on the main menu, but cycle the
  323. colours one way by pressing c. or as
  324. you like with the arrow keys.  It can
  325. easily be done.  A Gosub statement
  326. with a return.  A few REMs and Ouila!
  327.  
  328. Lines - Upto590 instructions already
  329. covered.
  330.  
  331. Line 590 "Q" always have an escape
  332. route!
  333.  
  334. Line 600 For Instructions.
  335. err...press "I" key"
  336.  
  337. Line 610-620 covered above. Hide,
  338. Colour.
  339.  
  340. Line 630 In case of faulty or erratic
  341. pressing of keys.  Now You wouldn't
  342. do that would you???
  343.  
  344. Line 650 menu for key 1 (skip the
  345. waffle)
  346.  
  347. Line 710 get a busier expense.
  348.  
  349. Line 720 put expense into next
  350. available slot.
  351.  
  352. Line 730 why is that reading to total
  353. expense equals total expense "minus"
  354. expense? ...I hate Maths!!!  ...Ah!
  355. well, it seems to work.
  356.  
  357. Line 740 again skip rubbish if Hide
  358. is on. OK.
  359.  
  360. Line 770 wait for key presses listed
  361. if hide is off, as it is by default.
  362.  
  363. NOTE: Still can't get past line 730.
  364. For experimental purposes, and
  365. perhaps due to the fact I've been
  366. doing this so long that time to wash
  367. up has come round again!  I have this
  368. zany idea to change the minus "-" to
  369. a plus "+" to see what happens.  But
  370. you'll have to find this out for
  371. yourselves...or 1 million in gold
  372. bullion should do nicely! -not at all
  373. overpriced!  (... ??? Did I just
  374. write how to find out?  ..."tut!")
  375.  
  376. Line 780-790 allows further additions
  377. if maximum Limit is not reached.  Try
  378. adding an "=", next to the "<" in
  379. 780.  (an oversight).  This will make
  380. full use of the dimensioned array
  381. (AKA. "slots") available.
  382.  
  383. Line 800-810 sends people away (with
  384. smacked handies) if they reach the
  385. limit.  There's room in memory to
  386. expand Max Limit (ML) if required. Up
  387. to 1280 seems self explanatory
  388. enough.  Except for 1030-1130 which
  389. is special  The FOR... at 1060 starts
  390. the list.
  391.  
  392. Line 1070 looks to see whether a key
  393. has been pressed as this will be
  394. stored in the relevant memory
  395. location.
  396.  
  397. Line 1080 If it has a P then it
  398. carries out this instruction, and
  399. everything else is Halted!  Until it
  400. has another P.  And the program is
  401. returned here from the similar sub at
  402. 2330.
  403.  
  404. 1090 If there's nothing in the slot
  405. we go back to the main menu.  (this
  406. will only happen if slot 0 has
  407. nothing in it.  As ML expands with
  408. the user input.
  409.  
  410. Line 1100 otherwise Print what's
  411. there.
  412.  
  413. Line 1110 continues with the next on
  414. the list.
  415.  
  416. Line 1120-1130 And on to the main sub
  417. for awaiting another key press.
  418.  
  419. Line 1140 tells us this is the
  420. editing tool.  So in Menu "3", the
  421. user pressed E.  (that might be worth
  422. noting.)
  423.  
  424. Line 1160 get out clause, if all else
  425. fails.  (Like Government funding
  426. doesn't come through or whatever.)
  427.  
  428. Line 1190 If nn is greater than ml.
  429. Denotes that ML is the marker as to
  430. where the last filled slot is.  So
  431. currently if 56 was typed in, the
  432. program would think what is going on
  433. here?  And send the user back to
  434. retype a "legal" or usable number.
  435. Otherwise we may proceed provide we
  436. didn't mess about with the minus
  437. symbol.
  438.  
  439. Line 1200 prints a reminder to reduce
  440. occurrence of error.
  441.  
  442. Line 1220 checks there's something to
  443. change or make reference to.
  444.  
  445. Line 1230 Waits for key press
  446.  
  447. Line 1240-1270 Self explanatory, or
  448. explained previously.
  449.  
  450. Line 1280-1300 gets new number.
  451.  
  452. Line1310 puts new number in to
  453. replace old.  ("New lamps for old"
  454. seems fitting somehow.)
  455.  
  456. Line 1320 if Hide is on.  Computer
  457. makes a sound to inform user this has
  458. been carried out, and is about ready
  459. to proceed.
  460.  
  461. Line 1330 perhaps, there should be a
  462. yes or no option here.  It is more
  463. complicated to put in than first
  464. glance would indicate.
  465.  
  466. TRY:
  467. 1471 geta$;ifa$=""then1471
  468. 1472 ifa$<>"n"thenpp=1  :goto 980
  469. Add at  1015 ifpp=1thenpp=0: goto 480
  470.  
  471. AND THERE WE HAVE AN INSTANCE, A
  472. CLEAR EXAMPLE OF HOW CODE TURNS INTO
  473. SPAGHETTI.  And Bolognese to it!At
  474. this stage it would be hard to get
  475. round this, short of a re-write (good
  476. luck with that one!), even than a
  477. jumbled up mess can still occur.
  478. Particularly if you suffer from Ideas
  479. aplenty (sense? err none.  In my
  480. case).  The other way you'll notice
  481. at 970 it also says what 1470
  482. reprints.  This is an attempt at
  483. memory jogging without the need to go
  484. into it again.  Which shouldn't be
  485. necessary with a few dummy runs.  And
  486. in Yape The plus4 emulator which this
  487. was programmed in.  You can open a
  488. second instance of the same program
  489. for reference if you get stuck.
  490.  
  491. Line 1490 If you press to quit it
  492. will go here and END.  This seemed
  493. like a good place to mark the program
  494. out from additional extras.
  495.  
  496. Line 2320 End of Instructions.
  497. ("feuwpf!")
  498.  
  499. Line 2300-2400 where program comes to
  500. in above menu.  Why here?  Well, it
  501. comes here in multiple parts of the
  502. program.  So it was best to have it
  503. in one place.
  504.  
  505. Line 2410-2590  My favourite idea of
  506. all time.  A simple but very pleasing
  507. idea.  That if some-one has to work
  508. late, or for long hours.  They can
  509. alter what they have to look at.
  510.  
  511. TIP:
  512. ----
  513. You could set an automatic option
  514. using ti$, where if set to on the
  515. border changes automatically, even at
  516. random.  Reset ti$ and have instances
  517. of checking throughout the program.
  518.  
  519. Firstly, it is important to note that
  520. while many of the commands look the
  521. same.  (geta$, ifa$..., etc.) they do
  522. not have to be placed the same way.
  523. Here you'll notice line2480 Geta$ Not
  524. "geta$:ifa$=""then2480" this blocks
  525. the program from moving until a key
  526. is pressed, however we let it
  527. continue in a loop.  (In all truth I
  528. was trying to put it more firmly into
  529. mind here that this can be done.  As
  530. every book I seem to have read seems
  531. to only cover one way)
  532.  
  533. Line 1030-1130  The use of this is
  534. better emphasised with the Pause
  535. button, key press in the above menu.
  536. But it is more complicated as to how
  537. that is derived being in two places.
  538. And as it is only needed with the
  539. listing of expenses.  Look at the
  540. list generator to see how this works.
  541.  We've covered similar with AATimer
  542. in the addition of an option in the
  543. main menu.  (I'm glad I could share
  544. this, as when it came to me I was
  545. overjoyed.  Feeling I'd arrived
  546. -somewhere- as an amateur programmer)
  547. Rest is self explanatory.
  548. Best Wishes
  549. (c)  John Fielden 2008
  550.  
  551. --
  552.  
  553.